package com.cynteka.cyfoman.core.config;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * User: Sergey
 * Date: 25.07.11
 * Time: 16:45
 */
@XmlRootElement
public class ActionQuery {
    private String checkSQL, sql;

    public ActionQuery(String sql) {
        this.sql = sql;
    }

    public ActionQuery(String checkSQL, String sql) {
        this.checkSQL = checkSQL;
        this.sql = sql;
    }

    public ActionQuery() {

    }

    @XmlElement
    public String getCheckSQL() {
        return checkSQL;
    }

    public void setCheckSQL(String checkSQL) {
        this.checkSQL = checkSQL;
    }

    @XmlElement
    public String getSql() {
        return sql;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ActionQuery that = (ActionQuery) o;

        if (checkSQL != null ? !checkSQL.equals(that.checkSQL) : that.checkSQL != null) return false;
        return !(sql != null ? !sql.equals(that.sql) : that.sql != null);

    }

    @Override
    public int hashCode() {
        int result = checkSQL != null ? checkSQL.hashCode() : 0;
        result = 31 * result + (sql != null ? sql.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "ActionQuery{" +
                "checkSQL='" + checkSQL + '\'' +
                ", sql='" + sql + '\'' +
                '}';
    }
}
